<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/11/22
  Time: 9:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <c:set var="root" value="${pageContext.request.contextPath}"/>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <link href="${root}/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <script src="${root}/bootstrap/js/bootstrap.js"></script>
    <script src="${root}/bootstrap/js/jquery-2.1.0.js"></script>

    <title>产品列表</title>
    <style type="text/css">
        #biaoti{
            height:24px;
            overflow: hidden;
            text-overflow:ellipsis;
            white-space: nowrap;
        }
    </style>
</head>
<body>
<div style="background-color: #f5fafe;width: 100%;height: 100%">
    <div class="row">
    <c:forEach var="c" items="${page.list}" varStatus="status">
        <div class="col-xs-2">
            <div class="thumbnail">
                <img src="${root}/${c.image}" alt="" style="height: 20%">
                <div class="caption">
                    <h5 id="biaoti">${c.pname}</h5>
                    <p>市场价：${c["market_price"]}</p>
                    <p>是否热销：
                        <c:if test="${c[\"is_hot\"] eq 1}">是</c:if>
                        <c:if test="${c[\"is_hot\"] ne 1}">否</c:if>
                    </p>
                    <p><a href="${root}/productEditUI.do?pid=${c.pid}" class="btn btn-primary btn-sm" role="button">修改</a> <a href="${root}/productDelete.do?pid=${c.pid}" class="btn btn-default btn-sm" role="button">删除</a></p>
                </div>
            </div>
        </div>
    </c:forEach>
    </div>

    <hr>
   <%--fenye--%>
  <nav aria-label="Page navigation" >
    <ul class="pagination" style="margin-left: 40%">
      <c:if test="${page.isFirstPage == true}">
        <li class="disabled">
          <a href="#" aria-label="Previous">
            <span aria-hidden="true">首页</span>
          </a>
        </li>
      </c:if>
      <c:if test="${page.isFirstPage != true}">
        <li>
          <a href="/findAllProduct.do?start=1" aria-label="Previous">
            <span aria-hidden="true">首页</span>
          </a>
        </li>
      </c:if>
      <c:if test="${page.isFirstPage == true}">
        <li class="disabled">
          <a href="#" aria-label="Previous">
            <span aria-hidden="true">上一页</span>
          </a>
        </li>
      </c:if>
      <c:if test="${page.isFirstPage != true}">
        <li>
          <a href="/findAllProduct.do?start=${page.prePage}" aria-label="Previous">
            <span aria-hidden="true">上一页</span>
          </a>
        </li>
      </c:if>
      <c:forEach begin="${page.navigateFirstPage}" end="${page.navigateLastPage}" var="item" step="1">
        <c:if test="${item == page.pageNum}">
          <li class="active">
            <a href="/findAllProduct.do?start=${item}">${item}</a>
          </li>
        </c:if>
        <c:if test="${item != page.pageNum}">
          <li>
            <a href="/findAllProduct.do?start=${item}">${item}</a>
          </li>
        </c:if>
      </c:forEach>
      <c:if test="${page.isLastPage == true}">
        <li class="disabled">
          <a href="#" aria-label="Next">
            <span aria-hidden="true">下一页</span>
          </a>
        </li>
      </c:if>
      <c:if test="${page.isLastPage != true}">
        <li>
          <a href="/findAllProduct.do?start=${page.nextPage}" aria-label="Next">
            <span aria-hidden="true">下一页</span>
          </a>
        </li>
      </c:if>
      <c:if test="${page.isLastPage == true}">
        <li class="disabled">
          <a href="#" aria-label="Next">
            <span aria-hidden="true">尾页</span>
          </a>
        </li>
      </c:if>
      <c:if test="${page.isLastPage != true}">
        <li>
          <a href="/findAllProduct.do?start=${page.pages}" aria-label="Next">
            <span aria-hidden="true">尾页</span>
          </a>
        </li>
      </c:if>
    </ul>
  </nav>


</div>
</body>
</html>
